package com.itheima.homework10;

import java.io.File;
import java.io.IOException;

/*
	3. File 类：练习 File 类的基础API
 */
public class Test03 {
    public static void main(String[] args) throws IOException {
        String path = "C:\\Users\\hldn\\Desktop\\ddddd";

        File file1 = new File(path);
        if(file1.isDirectory())
        {
            System.out.println("directory");
        }
        file1.mkdirs();
        File file = new File(path, "测试.txt");
        file.createNewFile();
        System.out.println(file.getAbsolutePath());
        System.out.println(file.getPath());
        File file2=new File("b.txt");
        System.out.println(file2.getAbsolutePath());
        System.out.println(file2.getPath());
        System.out.println(file2.getName());
        //当调用者为文件时，为null，当调用者为文件夹得具体数组
        File[] files = file1.listFiles();
        for (File file3 : files) {
            System.out.println(file3);
        }


        file.delete();

    }

}
